package com.david.documentation.web.view.components;

import org.apache.wicket.behavior.AbstractBehavior;
import org.apache.wicket.markup.html.IHeaderResponse;

public class FadeOutInfoMessageBehavior extends AbstractBehavior {

	private String selektor;
	private int duration;

	public FadeOutInfoMessageBehavior(String selektor, int duration){
		this.selektor = selektor;
		this.duration = duration;
	}

	@Override
	public void renderHead(IHeaderResponse response) {
		String js =
			"$('"+selektor+"').live('click',function(){$(this).stop(true, true); $(this).fadeOut('slow', function() {"+
	      		"$(this).remove();"+
   			"})});";
		response.renderOnLoadJavascript(js);
	}
}
